package com.github.beihaifeiwu.myspring.core;

import com.github.beihaifeiwu.myspring.core.feign.GlobalRequestInterceptor;
import com.github.beihaifeiwu.myspring.core.feign.PostRequestInterceptor;
import com.github.beihaifeiwu.myspring.http.feign.FeignBuilderConfigurer;
import com.github.beihaifeiwu.myspring.http.feign.FeignGlobalInterceptor;
import com.github.beihaifeiwu.myspring.test.MySpringTestPlainConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.Bean;

/**
 * Created by liupin on 2017/2/6.
 */
@MySpringTestPlainConfiguration
public class CoreTestApplication {

    @Bean
    public AsyncFeatureTest.AsyncTestDemo asyncTestDemo() {
        return new AsyncFeatureTest.AsyncTestDemo();
    }

    @Bean
    public JCacheFeatureTest.JCacheTestDemo jCacheTestDemo() {
        return new JCacheFeatureTest.JCacheTestDemo();
    }

    @Bean
    public SpringContextTest.EventListenerDemo eventListenerDemo() {
        return new SpringContextTest.EventListenerDemo();
    }

    @Bean
    @FeignGlobalInterceptor
    public GlobalRequestInterceptor globalRequestInterceptor() {
        return new GlobalRequestInterceptor();
    }

    @Bean
    public FeignBuilderConfigurer postConfigurer() {
        return builder -> builder.requestInterceptor(new PostRequestInterceptor());
    }

    public static void main(String[] args) {
        SpringApplication.run(CoreTestApplication.class, args);
    }
}
